package com.mxx.qh.dialog;

import android.view.View;
import android.widget.TextView;

import com.mxx.qh.R;
import com.yp.loading.base.BaseDialog;

/**
 * @ClassName: TokenEmptyDialog
 * @Description: java类作用描述
 * @Author: ljf89 (刘江飞)
 * @Date: 2021/1/15-- 18:10
 * @Email: 642371742@qq.com
 */
public class AppExitDialog extends BaseDialog {
    private TextView tv_hint;
    private TextView tv_cancel;
    private TextView tv_sure;
    private AppExitListener appExitListener;

    public void setAppExitListener(AppExitListener appExitListener) {
        this.appExitListener = appExitListener;
    }

    @Override
    public boolean isCancelable() {
        return false;
    }

    @Override
    protected boolean isCancelOutside() {
        return false;
    }

    @Override
    protected int setLayoutId() {
        return R.layout.dialog_app_exit;
    }

    @Override
    protected void initView() {
        super.initView();
        tv_hint = mRootView.findViewById(R.id.tv_hint);
        tv_cancel = mRootView.findViewById(R.id.tv_cancel);
        tv_sure = mRootView.findViewById(R.id.tv_sure);
    }

    @Override
    protected void initData() {
        super.initData();
        tv_hint.setText("是否退出？");
    }

    @Override
    protected void setListener() {
        super.setListener();
        tv_cancel.setOnClickListener(this);
        tv_sure.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.tv_cancel) {
            this.dismiss();
        }
        if (v.getId() == R.id.tv_sure) {
            this.dismiss();
            appExitListener.appExit();
        }
    }

    public interface AppExitListener {
        void appExit();
    }
}
